/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package teste;

import java.util.HashMap;

/**
 *
 * @author Caio
 */
public class FabricaRosto {
    private static final HashMap tracos = new HashMap();
    
    public  Flyweigth getTraco(String nome){
                Flyweigth tracoConcreto = (Flyweigth) tracos.get(nome) ;
                if (tracoConcreto==null){
                    if(nome.equals("O")){
                        tracoConcreto= new Olhos();
                    }else if (nome.equals("N")){
                        tracoConcreto = new Nariz();
                    }else if (nome.equals("B")){
                        tracoConcreto = new Boca();
                    }
                    tracos.put(nome, tracoConcreto);
                }
        return tracoConcreto ;
    }
}
